<script type="text/javascript">
        $(function () {
           $("#signature").jSignature({height:250,width:400,color:"#000",lineWidth:2}); 
           // $(".jSignature").css({ "width": "100%", "height": "100%" });
        });
        function reset() {
            var $sigdiv = $("#signature");
            $sigdiv.jSignature("reset");
        }
        function jSignatureTest() {
            var $sigdiv = $("#signature");
            var datapair = $sigdiv.jSignature("getData", "svgbase64"); //设置输出的格式，具体可以参考官方文档

           // var i = new Image();
            //i.src = "data:" + datapair[0] + "," + datapair[1]
           // $(i).appendTo($("#image")) // append the image (SVG) to DOM.

            $("#img").attr("src","data:"+ datapair);
            $("img").show();
            
            //处理文本框
            var imagebase64 = "data:"+ datapair
            $('#${id!}').attr('value', imagebase64); 
        }
    </script>
 
    <button class="btn btn-primary" data-toggle="modal" data-target="#regDialog">签字</button>
    <div id="image" style="margin: 20px" ></div>
    <img id="img"  src="${value!}">
    <div class="modal fade" id="regDialog">
        <div class="modal-dialog "  style="width:500px">
            <div class="modal-content ">
                <div class="modal-header">
                    <button type="button" data-dismiss="modal" class="close">&times;</button>
                    <h4 class="modal-title"> <span class="glyphicon glyphicon-user"></span>签名</h4>
                </div>
                <div class="modal-body " >
                     <div id="signature" >
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"  onclick="jSignatureTest()"  data-dismiss="modal">确认</button>
                    <button type="button" class="btn btn-default" onclick="reset()">重置</button>

                </div>
                </div>
            </div>
        </div>
    </div>
    
<%
// data-options
var verify = "";
if(isTrue(isNoN!) ){
	verify = "required=true";
}
if(!isEmpty(validator!)){
	if(verify != ''){
		verify += ';';
	}
	verify = verify + validator!;
}




var disabled="";
if(isTrue(isReadonly!) ||isTrue(view!)){
	disabled = 'readonly';
	verify = '';
}


value = isEmpty( value! ) ? defaultValue!:value!;
%>
<input type="text" id="${id!}" name="${name!}" class="hidden" value="${value!}"  aria-invalid="false"  placeholder="${placeholder!}" ${disabled!} bb-verify="${verify!}" ${strutil.replace(verify!,';',' ')}>